package com.cskaoyan.gateway.controller.shopping;

import com.mall.commons.result.ResponseData;
import com.mall.commons.result.ResponseUtil;
import com.mall.shopping.IHomeService;
import com.mall.shopping.dto.HomePageResponse;
import com.mall.shopping.dto.PanelContentDto;
import com.mall.shopping.dto.PanelDto;
import com.mall.user.annotation.Anoymous;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author ergwang
 * @date 2020-7-10 15:10
 * @com.cskaoyan.gateway.controller.shopping
 */

@RestController
@RequestMapping("/shopping")
public class HomeController {

    @Reference(timeout = 3000,check = false)
    IHomeService homeService;

    @Anoymous
    @GetMapping("/homepage")
    public ResponseData homepage(){
        List<PanelDto> homepage = homeService.homepage();
        return new ResponseUtil<List<PanelDto>>().setData(homepage);
    }

    @Anoymous
    @GetMapping("/navigation")
    public ResponseData navigation(){
        List<PanelContentDto> navigation = homeService.navigation();
        return new ResponseUtil<List<PanelContentDto>>().setData(navigation);
    }


}
